package com.ruicar.afs.jobadmin.core.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * The type AfsJobGroup
 * <p>Description: </p>
 *
 * @author Fzero
 * @version 1.0
 * @date Created on 2020.06.13 14:17:09
 * @since 1.0
 */
@Data
@TableName("afs_job_group")
public class AfsJobGroup {

    /**
     * Id
     * <p>Description: </p>
     */
    private int id;
    /**
     * App name
     * <p>Description: </p>
     */
    private String appName;
    /**
     * Title
     * <p>Description: </p>
     */
    private String title;
    /**
     * Sort order
     * <p>Description: </p>
     */
    private int sortOrder;
    /**
     * Address type
     * <p>Description: </p>
     */
    private int addressType;        // 执行器地址类型：0=自动注册、1=手动录入
    /**
     * Address list
     * <p>Description: </p>
     */
    private String addressList;     // 执行器地址列表，多地址逗号分隔(手动录入)

    /**
     * Registry list
     * <p>Description: </p>
     */
// registry list
    @TableField(exist = false)
    private List<String> registryList;  // 执行器地址列表(系统注册)

    /**
     * Get registry list list
     *
     * @return the list
     */
    public List<String> getRegistryList() {
        if (addressList != null && addressList.trim().length() > 0) {
            registryList = new ArrayList<String>(Arrays.asList(addressList.split(",")));
        }
        return registryList;
    }

}
